//
//  DLBaseTableView.m
//  delongzhitou
//
//  Created by Mr.Wang on 2018/11/22.
//  Copyright © 2018 delongzhitou. All rights reserved.
//

#import "DLBaseTableView.h"

@interface DLBaseTableView()

@property (nonatomic, assign) NSInteger page;

@end

@implementation DLBaseTableView



- (void)addRefreshHeader:(void (^)(NSInteger))refreshingBlock {
    self.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        if (refreshingBlock) {
            refreshingBlock(1);
        }
    }];
}

- (void)addRefreshFooter:(void (^)(NSInteger page))refreshingBlock {
    self.page = 1;
    kWeakSelf;
    self.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
        weakSelf.page ++;
        if (refreshingBlock) {
            refreshingBlock(weakSelf.page);
        }
    }];
}

- (void)endRefresh {
    [self endHeaderRefresh];
    [self endFooterRefresh];
}

- (void)removeRefresh {
    [self removeRefreshHeader];
    [self removeRefreshFooter];
}

- (void)endHeaderRefresh {
    [self.mj_header endRefreshing];
}

- (void)endFooterRefresh {
    [self.mj_footer endRefreshing];
}

- (void)removeRefreshHeader {
    //    [self.mj_header endRefreshing];
    self.mj_header = nil;
}

- (void)removeRefreshFooter {
    self.mj_footer = nil;
}
@end
